.class public Lcom/felhr/usbserial/CP2102SerialDevice;
.super Lcom/felhr/usbserial/UsbSerialDevice;
.source "CP2102SerialDevice.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;
    }
.end annotation


# static fields
.field private static final CLASS_ID:Ljava/lang/String; = "CP2102SerialDevice"


# instance fields
.field private breakCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbBreakCallback;

.field private ctsCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbCTSCallback;

.field private ctsState:Z

.field private dsrCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbDSRCallback;

.field private dsrState:Z

.field private dtrDsrEnabled:Z

.field private flowControlThread:Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;

.field private frameCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbFrameCallback;

.field private inEndpoint:Landroid/hardware/usb/UsbEndpoint;

.field private mInterface:Landroid/hardware/usb/UsbInterface;

.field private outEndpoint:Landroid/hardware/usb/UsbEndpoint;

.field private overrunCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbOverrunCallback;

.field private parityCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbParityCallback;

.field private requestIN:Landroid/hardware/usb/UsbRequest;

.field private rtsCtsEnabled:Z


# direct methods
.method public constructor <init>(Landroid/hardware/usb/UsbDevice;Landroid/hardware/usb/UsbDeviceConnection;I)V
    .locals 1

    .line 88
    invoke-direct {p0, p1, p2}, Lcom/felhr/usbserial/UsbSerialDevice;-><init>(Landroid/hardware/usb/UsbDevice;Landroid/hardware/usb/UsbDeviceConnection;)V

    const/4 p2, 0x0

    .line 89
    iput-boolean p2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->rtsCtsEnabled:Z

    .line 90
    iput-boolean p2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dtrDsrEnabled:Z

    const/4 v0, 0x1

    .line 91
    iput-boolean v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->ctsState:Z

    .line 92
    iput-boolean v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dsrState:Z

    if-ltz p3, :cond_0

    move p2, p3

    .line 93
    :cond_0
    invoke-virtual {p1, p2}, Landroid/hardware/usb/UsbDevice;->getInterface(I)Landroid/hardware/usb/UsbInterface;

    move-result-object p1

    iput-object p1, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    return-void
.end method

.method static synthetic access$000(Lcom/felhr/usbserial/CP2102SerialDevice;)[B
    .locals 0

    .line 13
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->getCommStatus()[B

    move-result-object p0

    return-object p0
.end method

.method static synthetic access$100(Lcom/felhr/usbserial/CP2102SerialDevice;)Z
    .locals 0

    .line 13
    iget-boolean p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->rtsCtsEnabled:Z

    return p0
.end method

.method static synthetic access$1000(Lcom/felhr/usbserial/CP2102SerialDevice;)Lcom/felhr/usbserial/UsbSerialInterface$UsbOverrunCallback;
    .locals 0

    .line 13
    iget-object p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->overrunCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbOverrunCallback;

    return-object p0
.end method

.method static synthetic access$1100(Lcom/felhr/usbserial/CP2102SerialDevice;)[B
    .locals 0

    .line 13
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->getModemState()[B

    move-result-object p0

    return-object p0
.end method

.method static synthetic access$200(Lcom/felhr/usbserial/CP2102SerialDevice;)Z
    .locals 0

    .line 13
    iget-boolean p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->ctsState:Z

    return p0
.end method

.method static synthetic access$202(Lcom/felhr/usbserial/CP2102SerialDevice;Z)Z
    .locals 0

    .line 13
    iput-boolean p1, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->ctsState:Z

    return p1
.end method

.method static synthetic access$300(Lcom/felhr/usbserial/CP2102SerialDevice;)Lcom/felhr/usbserial/UsbSerialInterface$UsbCTSCallback;
    .locals 0

    .line 13
    iget-object p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->ctsCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbCTSCallback;

    return-object p0
.end method

.method static synthetic access$400(Lcom/felhr/usbserial/CP2102SerialDevice;)Z
    .locals 0

    .line 13
    iget-boolean p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dtrDsrEnabled:Z

    return p0
.end method

.method static synthetic access$500(Lcom/felhr/usbserial/CP2102SerialDevice;)Z
    .locals 0

    .line 13
    iget-boolean p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dsrState:Z

    return p0
.end method

.method static synthetic access$502(Lcom/felhr/usbserial/CP2102SerialDevice;Z)Z
    .locals 0

    .line 13
    iput-boolean p1, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dsrState:Z

    return p1
.end method

.method static synthetic access$600(Lcom/felhr/usbserial/CP2102SerialDevice;)Lcom/felhr/usbserial/UsbSerialInterface$UsbDSRCallback;
    .locals 0

    .line 13
    iget-object p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dsrCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbDSRCallback;

    return-object p0
.end method

.method static synthetic access$700(Lcom/felhr/usbserial/CP2102SerialDevice;)Lcom/felhr/usbserial/UsbSerialInterface$UsbParityCallback;
    .locals 0

    .line 13
    iget-object p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->parityCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbParityCallback;

    return-object p0
.end method

.method static synthetic access$800(Lcom/felhr/usbserial/CP2102SerialDevice;)Lcom/felhr/usbserial/UsbSerialInterface$UsbFrameCallback;
    .locals 0

    .line 13
    iget-object p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->frameCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbFrameCallback;

    return-object p0
.end method

.method static synthetic access$900(Lcom/felhr/usbserial/CP2102SerialDevice;)Lcom/felhr/usbserial/UsbSerialInterface$UsbBreakCallback;
    .locals 0

    .line 13
    iget-object p0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->breakCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbBreakCallback;

    return-object p0
.end method

.method private createFlowControlThread()V
    .locals 1

    .line 558
    new-instance v0, Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;

    invoke-direct {v0, p0}, Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;-><init>(Lcom/felhr/usbserial/CP2102SerialDevice;)V

    iput-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->flowControlThread:Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;

    return-void
.end method

.method private getCTL()[B
    .locals 9

    const/4 v0, 0x2

    .line 605
    new-array v0, v0, [B

    .line 606
    iget-object v1, p0, Lcom/felhr/usbserial/UsbSerialDevice;->connection:Landroid/hardware/usb/UsbDeviceConnection;

    iget-object v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    invoke-virtual {v2}, Landroid/hardware/usb/UsbInterface;->getId()I

    move-result v5

    array-length v7, v0

    const/16 v2, 0xc1

    const/4 v3, 0x4

    const/4 v4, 0x0

    const/16 v8, 0x1388

    move-object v6, v0

    invoke-virtual/range {v1 .. v8}, Landroid/hardware/usb/UsbDeviceConnection;->controlTransfer(IIII[BII)I

    move-result v1

    .line 607
    sget-object v2, Lcom/felhr/usbserial/CP2102SerialDevice;->CLASS_ID:Ljava/lang/String;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "Control Transfer Response: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    return-object v0
.end method

.method private getCommStatus()[B
    .locals 9

    const/16 v0, 0x13

    .line 597
    new-array v0, v0, [B

    .line 598
    iget-object v1, p0, Lcom/felhr/usbserial/UsbSerialDevice;->connection:Landroid/hardware/usb/UsbDeviceConnection;

    iget-object v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    invoke-virtual {v2}, Landroid/hardware/usb/UsbInterface;->getId()I

    move-result v5

    const/16 v2, 0xc1

    const/16 v3, 0x10

    const/4 v4, 0x0

    const/16 v7, 0x13

    const/16 v8, 0x1388

    move-object v6, v0

    invoke-virtual/range {v1 .. v8}, Landroid/hardware/usb/UsbDeviceConnection;->controlTransfer(IIII[BII)I

    move-result v1

    .line 599
    sget-object v2, Lcom/felhr/usbserial/CP2102SerialDevice;->CLASS_ID:Ljava/lang/String;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "Control Transfer Response (Comm status): "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    return-object v0
.end method

.method private getModemState()[B
    .locals 9

    const/4 v0, 0x1

    .line 590
    new-array v0, v0, [B

    .line 591
    iget-object v1, p0, Lcom/felhr/usbserial/UsbSerialDevice;->connection:Landroid/hardware/usb/UsbDeviceConnection;

    iget-object v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    invoke-virtual {v2}, Landroid/hardware/usb/UsbInterface;->getId()I

    move-result v5

    const/16 v2, 0xc1

    const/16 v3, 0x8

    const/4 v4, 0x0

    const/4 v7, 0x1

    const/16 v8, 0x1388

    move-object v6, v0

    invoke-virtual/range {v1 .. v8}, Landroid/hardware/usb/UsbDeviceConnection;->controlTransfer(IIII[BII)I

    return-object v0
.end method

.method private openCP2102()Z
    .locals 7

    .line 518
    iget-object v0, p0, Lcom/felhr/usbserial/UsbSerialDevice;->connection:Landroid/hardware/usb/UsbDeviceConnection;

    iget-object v1, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    const/4 v2, 0x1

    invoke-virtual {v0, v1, v2}, Landroid/hardware/usb/UsbDeviceConnection;->claimInterface(Landroid/hardware/usb/UsbInterface;Z)Z

    move-result v0

    const/4 v1, 0x0

    if-eqz v0, :cond_5

    .line 520
    sget-object v0, Lcom/felhr/usbserial/CP2102SerialDevice;->CLASS_ID:Ljava/lang/String;

    const-string v3, "Interface succesfully claimed"

    invoke-static {v0, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 528
    iget-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    invoke-virtual {v0}, Landroid/hardware/usb/UsbInterface;->getEndpointCount()I

    move-result v0

    const/4 v3, 0x0

    :goto_0
    add-int/lit8 v4, v0, -0x1

    if-gt v3, v4, :cond_1

    .line 531
    iget-object v4, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    invoke-virtual {v4, v3}, Landroid/hardware/usb/UsbInterface;->getEndpoint(I)Landroid/hardware/usb/UsbEndpoint;

    move-result-object v4

    .line 532
    invoke-virtual {v4}, Landroid/hardware/usb/UsbEndpoint;->getType()I

    move-result v5

    const/4 v6, 0x2

    if-ne v5, v6, :cond_0

    .line 533
    invoke-virtual {v4}, Landroid/hardware/usb/UsbEndpoint;->getDirection()I

    move-result v5

    const/16 v6, 0x80

    if-ne v5, v6, :cond_0

    .line 535
    iput-object v4, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->inEndpoint:Landroid/hardware/usb/UsbEndpoint;

    goto :goto_1

    .line 538
    :cond_0
    iput-object v4, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->outEndpoint:Landroid/hardware/usb/UsbEndpoint;

    :goto_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    :cond_1
    const/4 v0, 0x0

    .line 544
    invoke-direct {p0, v1, v2, v0}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    move-result v3

    if-gez v3, :cond_2

    return v1

    :cond_2
    const/16 v3, 0x2580

    .line 546
    invoke-virtual {p0, v3}, Lcom/felhr/usbserial/CP2102SerialDevice;->setBaudRate(I)V

    const/4 v3, 0x3

    const/16 v4, 0x800

    .line 547
    invoke-direct {p0, v3, v4, v0}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    move-result v3

    if-gez v3, :cond_3

    return v1

    .line 549
    :cond_3
    invoke-virtual {p0, v1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setFlowControl(I)V

    const/4 v3, 0x7

    .line 550
    invoke-direct {p0, v3, v1, v0}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    move-result v0

    if-gez v0, :cond_4

    return v1

    :cond_4
    return v2

    .line 523
    :cond_5
    sget-object v0, Lcom/felhr/usbserial/CP2102SerialDevice;->CLASS_ID:Ljava/lang/String;

    const-string v2, "Interface could not be claimed"

    invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    return v1
.end method

.method private setControlCommand(II[B)I
    .locals 9

    if-eqz p3, :cond_0

    .line 581
    array-length v0, p3

    move v7, v0

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    const/4 v7, 0x0

    .line 583
    :goto_0
    iget-object v1, p0, Lcom/felhr/usbserial/UsbSerialDevice;->connection:Landroid/hardware/usb/UsbDeviceConnection;

    const/16 v2, 0x41

    iget-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    invoke-virtual {v0}, Landroid/hardware/usb/UsbInterface;->getId()I

    move-result v5

    const/16 v8, 0x1388

    move v3, p1

    move v4, p2

    move-object v6, p3

    invoke-virtual/range {v1 .. v8}, Landroid/hardware/usb/UsbDeviceConnection;->controlTransfer(IIII[BII)I

    move-result p1

    .line 584
    sget-object p2, Lcom/felhr/usbserial/CP2102SerialDevice;->CLASS_ID:Ljava/lang/String;

    new-instance p3, Ljava/lang/StringBuilder;

    invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Control Transfer Response: "

    invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p3

    invoke-static {p2, p3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    return p1
.end method

.method private startFlowControlThread()V
    .locals 1

    .line 563
    iget-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->flowControlThread:Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;

    invoke-virtual {v0}, Ljava/lang/Thread;->isAlive()Z

    move-result v0

    if-nez v0, :cond_0

    .line 564
    iget-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->flowControlThread:Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    :cond_0
    return-void
.end method

.method private stopFlowControlThread()V
    .locals 1

    .line 569
    iget-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->flowControlThread:Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;

    if-eqz v0, :cond_0

    .line 571
    invoke-virtual {v0}, Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;->stopThread()V

    const/4 v0, 0x0

    .line 572
    iput-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->flowControlThread:Lcom/felhr/usbserial/CP2102SerialDevice$FlowControlThread;

    :cond_0
    return-void
.end method


# virtual methods
.method public close()V
    .locals 2

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 129
    invoke-direct {p0, v0, v0, v1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    .line 130
    invoke-virtual {p0}, Lcom/felhr/usbserial/UsbSerialDevice;->killWorkingThread()V

    .line 131
    invoke-virtual {p0}, Lcom/felhr/usbserial/UsbSerialDevice;->killWriteThread()V

    .line 132
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->stopFlowControlThread()V

    .line 133
    iget-object v0, p0, Lcom/felhr/usbserial/UsbSerialDevice;->connection:Landroid/hardware/usb/UsbDeviceConnection;

    iget-object v1, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->mInterface:Landroid/hardware/usb/UsbInterface;

    invoke-virtual {v0, v1}, Landroid/hardware/usb/UsbDeviceConnection;->releaseInterface(Landroid/hardware/usb/UsbInterface;)Z

    return-void
.end method

.method public getBreak(Lcom/felhr/usbserial/UsbSerialInterface$UsbBreakCallback;)V
    .locals 0

    .line 372
    iput-object p1, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->breakCallback:Lcom/felhr/usbserial/UsbSerialInterface$UsbBreakCallback;

    return-void
.end method

.method public open()Z
    .locals 3

    .line 99
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->openCP2102()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 104
    new-instance v0, Landroid/hardware/usb/UsbRequest;

    invoke-direct {v0}, Landroid/hardware/usb/UsbRequest;-><init>()V

    iput-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->requestIN:Landroid/hardware/usb/UsbRequest;

    .line 105
    iget-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->requestIN:Landroid/hardware/usb/UsbRequest;

    iget-object v1, p0, Lcom/felhr/usbserial/UsbSerialDevice;->connection:Landroid/hardware/usb/UsbDeviceConnection;

    iget-object v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->inEndpoint:Landroid/hardware/usb/UsbEndpoint;

    invoke-virtual {v0, v1, v2}, Landroid/hardware/usb/UsbRequest;->initialize(Landroid/hardware/usb/UsbDeviceConnection;Landroid/hardware/usb/UsbEndpoint;)Z

    .line 108
    invoke-virtual {p0}, Lcom/felhr/usbserial/UsbSerialDevice;->restartWorkingThread()V

    .line 109
    invoke-virtual {p0}, Lcom/felhr/usbserial/UsbSerialDevice;->restartWriteThread()V

    .line 112
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->createFlowControlThread()V

    .line 115
    iget-object v0, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->requestIN:Landroid/hardware/usb/UsbRequest;

    iget-object v1, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->outEndpoint:Landroid/hardware/usb/UsbEndpoint;

    invoke-virtual {p0, v0, v1}, Lcom/felhr/usbserial/UsbSerialDevice;->setThreadsParams(Landroid/hardware/usb/UsbRequest;Landroid/hardware/usb/UsbEndpoint;)V

    const/4 v0, 0x1

    .line 117
    iput-boolean v0, p0, Lcom/felhr/usbserial/UsbSerialDevice;->asyncMode:Z

    return v0

    :cond_0
    const/4 v0, 0x0

    return v0
.end method

.method public setBaudRate(I)V
    .locals 4

    const/4 v0, 0x4

    .line 164
    new-array v0, v0, [B

    and-int/lit16 v1, p1, 0xff

    int-to-byte v1, v1

    const/4 v2, 0x0

    aput-byte v1, v0, v2

    shr-int/lit8 v1, p1, 0x8

    and-int/lit16 v1, v1, 0xff

    int-to-byte v1, v1

    const/4 v3, 0x1

    aput-byte v1, v0, v3

    shr-int/lit8 v1, p1, 0x10

    and-int/lit16 v1, v1, 0xff

    int-to-byte v1, v1

    const/4 v3, 0x2

    aput-byte v1, v0, v3

    shr-int/lit8 p1, p1, 0x18

    and-int/lit16 p1, p1, 0xff

    int-to-byte p1, p1

    const/4 v1, 0x3

    aput-byte p1, v0, v1

    const/16 p1, 0x1e

    .line 170
    invoke-direct {p0, p1, v2, v0}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    return-void
.end method

.method public setDataBits(I)V
    .locals 4

    .line 176
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->getCTL()[B

    move-result-object v0

    const/4 v1, 0x5

    const/16 v2, 0x8

    const/4 v3, 0x1

    if-eq p1, v1, :cond_3

    const/4 v1, 0x6

    if-eq p1, v1, :cond_2

    const/4 v1, 0x7

    if-eq p1, v1, :cond_1

    if-eq p1, v2, :cond_0

    return-void

    .line 189
    :cond_0
    aput-byte v2, v0, v3

    goto :goto_0

    .line 186
    :cond_1
    aput-byte v1, v0, v3

    goto :goto_0

    .line 183
    :cond_2
    aput-byte v1, v0, v3

    goto :goto_0

    .line 180
    :cond_3
    aput-byte v1, v0, v3

    .line 194
    :goto_0
    aget-byte p1, v0, v3

    shl-int/2addr p1, v2

    const/4 v1, 0x0

    aget-byte v0, v0, v1

    and-int/lit16 v0, v0, 0xff

    or-int/2addr p1, v0

    int-to-byte p1, p1

    const/4 v0, 0x3

    const/4 v1, 0x0

    .line 195
    invoke-direct {p0, v0, p1, v1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    return-void
.end method

.method public setFlowControl(I)V
    .locals 8

    const/16 v0, 0x13

    const/16 v1, 0x10

    const/4 v2, 0x0

    if-eqz p1, :cond_5

    const/4 v3, 0x4

    const/4 v4, 0x0

    const/4 v5, 0x7

    const/4 v6, 0x1

    if-eq p1, v6, :cond_3

    const/4 v7, 0x2

    if-eq p1, v7, :cond_1

    const/4 v3, 0x3

    if-eq p1, v3, :cond_0

    return-void

    .line 314
    :cond_0
    new-array p1, v1, [B

    fill-array-data p1, :array_0

    const/4 v1, 0x6

    .line 321
    new-array v1, v1, [B

    fill-array-data v1, :array_1

    const/16 v3, 0x19

    .line 325
    invoke-direct {p0, v3, v2, v1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    .line 326
    invoke-direct {p0, v0, v2, p1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    goto :goto_0

    .line 299
    :cond_1
    new-array p1, v1, [B

    fill-array-data p1, :array_2

    .line 305
    iput-boolean v6, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dtrDsrEnabled:Z

    .line 306
    iput-boolean v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->rtsCtsEnabled:Z

    .line 307
    invoke-direct {p0, v0, v2, p1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    const/16 p1, 0x101

    .line 308
    invoke-direct {p0, v5, p1, v4}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    .line 309
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->getCommStatus()[B

    move-result-object p1

    .line 310
    aget-byte p1, p1, v3

    and-int/2addr p1, v7

    if-nez p1, :cond_2

    const/4 v2, 0x1

    :cond_2
    iput-boolean v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dsrState:Z

    .line 311
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->startFlowControlThread()V

    goto :goto_0

    .line 284
    :cond_3
    new-array p1, v1, [B

    fill-array-data p1, :array_3

    .line 290
    iput-boolean v6, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->rtsCtsEnabled:Z

    .line 291
    iput-boolean v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dtrDsrEnabled:Z

    .line 292
    invoke-direct {p0, v0, v2, p1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    const/16 p1, 0x202

    .line 293
    invoke-direct {p0, v5, p1, v4}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    .line 294
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->getCommStatus()[B

    move-result-object p1

    .line 295
    aget-byte p1, p1, v3

    and-int/2addr p1, v6

    if-nez p1, :cond_4

    const/4 v2, 0x1

    :cond_4
    iput-boolean v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->ctsState:Z

    .line 296
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->startFlowControlThread()V

    goto :goto_0

    .line 273
    :cond_5
    new-array p1, v1, [B

    fill-array-data p1, :array_4

    .line 279
    iput-boolean v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->rtsCtsEnabled:Z

    .line 280
    iput-boolean v2, p0, Lcom/felhr/usbserial/CP2102SerialDevice;->dtrDsrEnabled:Z

    .line 281
    invoke-direct {p0, v0, v2, p1}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    :goto_0
    return-void

    nop

    :array_0
    .array-data 1
        0x1t
        0x0t
        0x0t
        0x0t
        0x43t
        0x0t
        0x0t
        0x0t
        0x0t
        -0x80t
        0x0t
        0x0t
        0x0t
        0x20t
        0x0t
        0x0t
    .end array-data

    :array_1
    .array-data 1
        0x0t
        0x0t
        0x0t
        0x0t
        0x11t
        0x13t
    .end array-data

    nop

    :array_2
    .array-data 1
        0x11t
        0x0t
        0x0t
        0x0t
        0x40t
        0x0t
        0x0t
        0x0t
        0x0t
        -0x80t
        0x0t
        0x0t
        0x0t
        0x20t
        0x0t
        0x0t
    .end array-data

    :array_3
    .array-data 1
        0x9t
        0x0t
        0x0t
        0x0t
        0x40t
        0x0t
        0x0t
        0x0t
        0x0t
        -0x80t
        0x0t
        0x0t
        0x0t
        0x20t
        0x0t
        0x0t
    .end array-data

    :array_4
    .array-data 1
        0x1t
        0x0t
        0x0t
        0x0t
        0x40t
        0x0t
        0x0t
        0x0t
        0x0t
        -0x80t
        0x0t
        0x0t
        0x0t
        0x20t
        0x0t
        0x0t
    .end array-data
.end method

.method public setParity(I)V
    .locals 5

    .line 227
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->getCTL()[B

    move-result-object v0

    const/4 v1, 0x3

    const/4 v2, 0x1

    const/4 v3, 0x0

    if-eqz p1, :cond_4

    if-eq p1, v2, :cond_3

    const/4 v4, 0x2

    if-eq p1, v4, :cond_2

    if-eq p1, v1, :cond_1

    const/4 v4, 0x4

    if-eq p1, v4, :cond_0

    return-void

    .line 255
    :cond_0
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x11

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 256
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x21

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 257
    aget-byte p1, v0, v3

    or-int/lit8 p1, p1, 0x40

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 258
    aget-byte p1, v0, v3

    and-int/lit16 p1, p1, -0x81

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    goto :goto_0

    .line 249
    :cond_1
    aget-byte p1, v0, v3

    or-int/lit8 p1, p1, 0x10

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 250
    aget-byte p1, v0, v3

    or-int/lit8 p1, p1, 0x20

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 251
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x41

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 252
    aget-byte p1, v0, v3

    and-int/lit16 p1, p1, -0x81

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    goto :goto_0

    .line 243
    :cond_2
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x11

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 244
    aget-byte p1, v0, v3

    or-int/lit8 p1, p1, 0x20

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 245
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x41

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 246
    aget-byte p1, v0, v3

    and-int/lit16 p1, p1, -0x81

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    goto :goto_0

    .line 237
    :cond_3
    aget-byte p1, v0, v3

    or-int/lit8 p1, p1, 0x10

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 238
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x21

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 239
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x41

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 240
    aget-byte p1, v0, v3

    and-int/lit16 p1, p1, -0x81

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    goto :goto_0

    .line 231
    :cond_4
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x11

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 232
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x21

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 233
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x41

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 234
    aget-byte p1, v0, v3

    and-int/lit16 p1, p1, -0x81

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 263
    :goto_0
    aget-byte p1, v0, v2

    shl-int/lit8 p1, p1, 0x8

    aget-byte v0, v0, v3

    and-int/lit16 v0, v0, 0xff

    or-int/2addr p1, v0

    int-to-byte p1, p1

    const/4 v0, 0x0

    .line 264
    invoke-direct {p0, v1, p1, v0}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    return-void
.end method

.method public setStopBits(I)V
    .locals 5

    .line 202
    invoke-direct {p0}, Lcom/felhr/usbserial/CP2102SerialDevice;->getCTL()[B

    move-result-object v0

    const/4 v1, 0x3

    const/4 v2, 0x1

    const/4 v3, 0x0

    if-eq p1, v2, :cond_2

    const/4 v4, 0x2

    if-eq p1, v4, :cond_1

    if-eq p1, v1, :cond_0

    return-void

    .line 210
    :cond_0
    aget-byte p1, v0, v3

    or-int/2addr p1, v2

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 211
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x3

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    goto :goto_0

    .line 214
    :cond_1
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x2

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 215
    aget-byte p1, v0, v3

    or-int/2addr p1, v4

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    goto :goto_0

    .line 206
    :cond_2
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x2

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 207
    aget-byte p1, v0, v3

    and-int/lit8 p1, p1, -0x3

    int-to-byte p1, p1

    aput-byte p1, v0, v3

    .line 220
    :goto_0
    aget-byte p1, v0, v2

    shl-int/lit8 p1, p1, 0x8

    aget-byte v0, v0, v3

    and-int/lit16 v0, v0, 0xff

    or-int/2addr p1, v0

    int-to-byte p1, p1

    const/4 v0, 0x0

    .line 221
    invoke-direct {p0, v1, p1, v0}, Lcom/felhr/usbserial/CP2102SerialDevice;->setControlCommand(II[B)I

    return-void
.end method
